package com.estronger.shopmanage.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.estronger.shopmanage.base.MyApplication;

/**
 * SharePreference 封装，以便更轻松的获取-存储本地信息
 * 
 * @author gao uj
 * 
 */
public class PrefUtils {

	public static final String PREF_NAME = "config";
	public static final String BUNDLEARRAY = "bundle_array";//绑定的list集合

	/**
	 * 订单录入
	 */
	public static final String WHITCHSHUXING = "WHITCHSHUXING";//哪个模块

	public static boolean getBoolean(Context ctx, String key,
			boolean defaultValue) {
		SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
				Context.MODE_PRIVATE);
		return sp.getBoolean(key, defaultValue);
	}

	public static void setBoolean(Context ctx, String key, boolean value) {
		SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
				Context.MODE_PRIVATE);
		sp.edit().putBoolean(key, value).commit();
	}

	public static String getString(Context ctx, String key, String defaultValue) {
		SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
				Context.MODE_PRIVATE);
		return sp.getString(key, defaultValue);
	}

	public static void setString(Context ctx, String key, String value) {
		SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME,
				Context.MODE_PRIVATE);
		sp.edit().putString(key, value).commit();
	}
}
